<template>
  <view class="posting-item">
    <view class="posting-header">
      <view class="avatar">
        <img :src="itemData.avatarUrl" alt="" />
      </view>
      <view class="user-info">
        <view class="user-name">{{ itemData.nickName }}</view>
        <view class="post-date">{{
          new Date(itemData.time).toLocaleDateString()
        }}</view>
      </view>
    </view>
    <view class="title">{{ itemData.title }}</view>
    <view class="detail">{{ itemData.detail }}</view>
    <view class="options-box">
      <!-- TODO 点赞收藏数 -->
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },

  props: {
    itemData: {
      require: true,
    },
  },

  components: {},
};
</script>

<style lang='scss' scoped>
.posting-item {
  padding: 30rpx;
  background: #fff;
  margin-bottom: 30rpx;
  .posting-header {
    display: flex;
    align-items: center;
    .avatar {
      height: 80rpx;
      width: 80rpx;
      img {
        height: 100%;
        width: 100%;
        border-radius: 199rpx;
      }
    }
    .user-info {
      margin-left: 20rpx;
      .user-name {
        font-size: 28rpx;
      }
      .post-date {
        font-size: 24rpx;
        color: #666;
        margin-top: 10rpx;
      }
    }
  }
  .title {
    margin-top: 20rpx;
    font-size: 34rpx;
  }
  .detail {
    margin-top: 10rpx;
    font-size: 32rpx;
    color: #666;
    display: -webkit-box; //使用自适应布局
    overflow: hidden;
    -webkit-line-clamp: 2; //设置超出行数，要设置超出几行显示省略号就把这里改成几
    -webkit-box-orient: vertical;
  }
}
</style>